<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>    
    
    <div id="app">       
        <book type="文学类">
           <div>
                <img src="./imgs/logo.png"/>
                <h3>文学类</h3>
           </div> 
        </book>
    </div>
    <script src="./js/vue.global.js"></script>
    <script>
        let book = {     
            props:['type'],
            template:`
                <div>
                    <slot>
                        <h1>{{type}}的书籍列表</h1>
                    </slot>                    
                    <hr/>
                    <ul>
                        <li v-for="b in datas">
                            <p>书名:{{b.name}}</p>
                            <p>作者:{{b.author}}</p>
                        </li>
                    </ul>
                    <hr/>
                </div>   
            `,
            data(){
                return {
                    datas:[
                        {
                            name:"三国演义",
                            author:"罗贯中"
                        },
                        {
                            name:"四国演义",
                            author:"晨光斯基"
                        }
                    ]
                }
            }
           
        }
       
        let app = Vue.createApp({
            components:{
                book
            },
            data(){
                return {
                    
                }
            }                     
        });

       
      
        app.mount("#app");

    </script>
</body>
</html>